﻿
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TestXNA3.Resources.Shaders
{
    public class SkeletalMeshDefaultShader : StaticMeshDefaultShader
    {
        static protected Effect _skeletalMeshDefaultShader = null;

        public Matrix[] BoneList;

        public SkeletalMeshDefaultShader()
        {
            if (_skeletalMeshDefaultShader == null)
            {
                _skeletalMeshDefaultShader = GameStartup.ContentManager.Load<Effect>("Shaders/SkeletalMeshDefaultShader");
            }
            Effect = _skeletalMeshDefaultShader;
            foreach (EffectTechnique t in Effect.Techniques)
            {
                if (t.Name == "Default")
                {
                    _defaultTechnique = t;
                }
                else
                if (t.Name == "DepthOnly")
                {
                    _depthOnlyTechnique = t;
                }
            }
        }

        public override void ApplyShaderConst()
        {
            base.ApplyShaderConst();
            Effect.Parameters["BoneList"].SetValue(BoneList);
        }
    }
}
